package com.github;

import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Description:
 *
 * @author zwl
 * @version 1.0
 * @date 2021/8/11 下午2:11
 */
public class Test2 {

    public Map<Integer,String> map = new HashMap<>();

    public static void main(String[] args) throws NoSuchFieldException {
        //Object obj = null;
        //
        //setXXX(obj);
        //
        //System.out.println(obj);

        //List<Integer> a = new ArrayList<>();
        //List<String> b = new ArrayList<>();
        //
        //System.out.println(a.getClass());
        //System.out.println(b.getClass());
        //
        //System.out.println(a.getClass() == b.getClass());

        Field fa = Test2.class.getField("map");
        System.out.println(fa.getType());
        Type type = fa.getGenericType();
        if (type instanceof ParameterizedType) {
            ParameterizedType pt = ((ParameterizedType) type);
            Type [] acType = pt.getActualTypeArguments();
            for (Type t : acType) {
                System.out.println(t);
            }
        }
    }

    public static void setXXX(Object obj){
        obj = new Object();
    }

}
